# -*- coding: utf-8 -*-
# @Time    : 2022/11/11
# @Author  : paulin

from basic.UIParent import UIParent
from commen.page.ann.myPage import myPage
from commen.page.ann.indexPage import IndexPage
from commen.page.ann.allAppPage import allAppPage
from basic.utils.asserts import asserts

class collectionAppCase (UIParent):

    @classmethod
    def test_collectionApp(cls):
        # 收藏应用
        myPage.loginByStatu()
        IndexPage.clickIndex()
        IndexPage.getCollectTabPos()
        myApp = IndexPage.collectApp()
        IndexPage.clickAdd(myApp[-1])
        if len(myApp)>14:
            print("删除的应用：",myApp[-2])
            allAppPage.editApp(myApp[-2])
        appList = allAppPage.getGroupApp()
        for i in range(0, len(appList)):
            if appList[i] not in myApp:
                print("新增的应用：",appList[i])
                addApp = appList[i]
                allAppPage.editApp(appList[i])
                break
        allAppPage.save()
        allAppPage.clickBack()
        newMyApp = IndexPage.collectApp()
        asserts.contain(addApp,newMyApp,"收藏应用校验")
